package com.step.ems.api

import androidx.annotation.StringRes
import androidx.compose.ui.graphics.Color
import com.step.ems.R

enum class UrgentType(@StringRes val titleResId: Int, val value: Int) {
    Stop(R.string.urgentTypeStop, 0),
    People(R.string.urgentTypePeople, 1);

    companion object {
        fun getItem(value: Int): UrgentType? {
            return entries.firstOrNull { it.value == value }
        }
    }
}

enum class UrgentStatus(@StringRes val titleResId: Int, val value: Int) {
    Alarmed(R.string.urgentStatusAlarmed, 0),
    Accept(R.string.urgentStatusAccept, 1),
    Arrow(R.string.urgentStatusArrow, 2),
    Completed(R.string.urgentStatusCompleted, 3),
    Confirmed(R.string.urgentStatusConfirmed, 4);

    companion object {
        fun getTitleRes(value: Int): Int {
            return entries.firstOrNull { it.value == value }?.titleResId ?: R.string.none
        }
    }
}

enum class WbStatus(@StringRes val titleResId: Int, val value: Int?, val color: Color) {
    All(R.string.wbStatusAll, null, Color.Black),
    Created(R.string.wbStatusCreated, 0, Color.Gray),
    CheckedIn(R.string.wbStatusCheckedIn, 1, Color(0xFF5AB6E2)),
    Completed(R.string.wbStatusCompleted, 2, Color(0xFF4ED072)),
    Confirmed(R.string.wbStatusConfirmed, 3, Color(0xFF4ED072));

    companion object {
        fun getItem(value: Int): WbStatus? {
            return entries.firstOrNull { it.value == value }
        }

        fun getTitleRes(value: Int): Int {
            return getItem(value)?.titleResId ?: R.string.none
        }
    }
}

enum class ElevatorUseStatus(@StringRes val titleResId: Int, val value: Int) {
    InUse(R.string.elevatorUseStatusInUse, 1),
    Scrapped(R.string.elevatorUseStatusScrapped, 2),
    Deactivated(R.string.elevatorUseStatusDeactivated, 3),
    Revoked(R.string.elevatorUseStatusRevoked, 4);

    companion object {
        fun getTitleRes(value: Int): Int {
            return entries.firstOrNull { it.value == value }?.titleResId ?: R.string.none
        }
    }
}

enum class WbArea(@StringRes val titleResId: Int, val value: Int) {
    Type0(R.string.wbArea0, 0),
    Type1(R.string.wbArea1, 1),
    Type2(R.string.wbArea2, 2),
    Type3(R.string.wbArea3, 3),
    Type4(R.string.wbArea4, 4),
    Type5(R.string.wbArea5, 5);

    companion object {
        fun getTitleRes(value: Int): Int {
            return entries.firstOrNull { it.value == value }?.titleResId ?: R.string.none
        }
    }
}